From 9886775566042d1d1a896dac638b6cb6c4346d47 Mon Sep 17 00:00:00 2001 From: robertlipe Date: Mon, 7 Jul 2014 04:36:10 +0000 Subject: [PATCH] Cut a little more Windows CP-1252 code. --- gpsbabel/cet_util.cc | 35 +---------------------------------- gpsbabel/garmin_txt.cc | 10 +++++++--- 2 files changed, 8 insertions(+), 37 deletions(-) diff --git a/gpsbabel/cet_util.cc b/gpsbabel/cet_util.cc index 9a7b09fe8..3122b9a9b 100644 --- a/gpsbabel/cet_util.cc +++ b/gpsbabel/cet_util.cc @@ -51,18 +51,8 @@ static int cet_output = 0; #include "cet/ansi_x3_4_1968.h" #include "cet/cp1252.h" -/* %%% short hand strings transmission for main character sets %%% */ -char* -cet_str_utf8_to_cp1252(const char* src) -{ - return cet_str_utf8_to_any(src, &cet_cs_vec_cp1252); -} -char* -cet_str_cp1252_to_utf8(const char* src) -{ - return cet_str_any_to_utf8(src, &cet_cs_vec_cp1252); -} +/* %%% short hand strings transmission for main character sets %%% */ short* cet_str_utf8_to_uni(const char* src, int* length) @@ -151,14 +141,6 @@ cet_cs_alias_qsort_cb(const void* a, const void* b) return case_ignore_strcmp(va->name, vb->name); } -static signed int -cet_cs_vec_qsort_cb(const void* a, const void* b) -{ - const cet_cs_vec_t* va = *(cet_cs_vec_t**)a; - const cet_cs_vec_t* vb = *(cet_cs_vec_t**)b; - return case_ignore_strcmp(va->name, vb->name); -} - void cet_register_cs(cet_cs_vec_t* vec) { @@ -208,24 +190,9 @@ cet_register(void) #ifdef cet_cs_name_ansi_x3_4_1968 cet_register_cs(&cet_cs_vec_ansi_x3_4_1968); #endif -#ifdef cet_cs_name_cp1250 - cet_register_cs(&cet_cs_vec_cp1250); -#endif #ifdef cet_cs_name_cp1252 cet_register_cs(&cet_cs_vec_cp1252); #endif -#ifdef cet_cs_name_cp1255 - cet_register_cs(&cet_cs_vec_cp1255); -#endif -#ifdef cet_cs_name_iso_8859_1 - cet_register_cs(&cet_cs_vec_iso_8859_1); -#endif -#ifdef cet_cs_name_iso_8859_15 - cet_register_cs(&cet_cs_vec_iso_8859_15); -#endif -#ifdef cet_cs_name_iso_8859_8 - cet_register_cs(&cet_cs_vec_iso_8859_8); -#endif if (cet_cs_vec_ct > 0) { cet_cs_vec_t* p; diff --git a/gpsbabel/garmin_txt.cc b/gpsbabel/garmin_txt.cc index ff67ed335..722238a1d 100644 --- a/gpsbabel/garmin_txt.cc +++ b/gpsbabel/garmin_txt.cc @@ -61,6 +61,10 @@ static int current_line; static char* date_time_format = NULL; static int precision = 3; static time_t utc_offs = 0; +// Having a Windows background, this software encodes degree marks in +// Windows CP-1252. We don't attempt to handle all the subtleties of that, +// but since we write degree marks and we know how they're encoded, use this. +static const int kDegreeSymbol = 0xB0; static gtxt_flags_t gtxt_flags; @@ -424,7 +428,7 @@ print_course(const Waypoint* A, const Waypoint* B) /* seems to be okay */ if ((A != NULL) && (B != NULL) && (A != B)) { int course; course = si_round(waypt_course(A, B)); - cet_gbfprintf(fout, &cet_cs_vec_cp1252, "%d%c true", course, 0xB0); + gbfprintf(fout, "%d%c true", course, kDegreeSymbol); } } @@ -827,9 +831,9 @@ garmin_txt_write(void) grid_str = xstrdup(gt_get_mps_grid_longname(grid_index, MYNAME)); while ((c = strchr(grid_str, '*'))) { - *c = 0xB0; /* degree sign */ + *c = kDegreeSymbol; /* degree sign */ } - cet_gbfprintf(fout, &cet_cs_vec_cp1252, "Grid\t%s\r\n", grid_str); + gbfprintf(fout, "Grid\t%s\r\n", grid_str); xfree(grid_str); datum_str = gt_get_mps_datum_name(datum_index); -- 2.30.2